import {
  wxRequest,
  wxUploadFile
} from '@/utils/wxRequest';

const apiMall = 'https://wx.pingpingapp.com/mmm';

//微信的jscode换取sessionKey
const wxJsCode2Session = (params) => wxRequest(params, apiMall + "/token/login");
// const user2session = (params) => wxRequest(params, apiMall + "/api/wechat/user2session?jsoncallback=?");
const userInfo2Token = (params) => wxRequest(params, apiMall + "/token/register");

//新增名片
const addMyCard = (params) => wxRequest(params, apiMall + "/user/add");
//发送验证码
const sendCode = (params) => wxRequest(params, apiMall + "/code/sendCode");
//用户首页
const index = (params) => wxRequest(params, apiMall + '/index');
//改变二维码
const changeCode = (params) => wxRequest(params, apiMall + '/user/changeCode');
//名片夹接口
const findCollect = (params) => wxRequest(params, apiMall + '/collection/findCollect');
//名片详情
const detail = (params) => wxRequest(params, apiMall + '/user/detail');
//取消收藏 / 重新收藏接口
const collAddOrEdit = (params) => wxRequest(params, apiMall + '/collection/addOrEdit');
//删除名片
const cardDelete = (params) => wxRequest(params, apiMall + '/card/delete');
// 查询分组和分组人数
const findGroup = (params) => wxRequest(params, apiMall + '/group/findGroup');
// 分配分组
const distribution = (params) => wxRequest(params, apiMall + '/group/distribution');
//编辑来源
const editSource = (params) => wxRequest(params, apiMall + '/collection/editSource');
//名片识别添加或修改
const cardAddOrEdit = (params) => wxRequest(params, apiMall + '/card/addOrEdit');
//根据公司和名称判断添加
const inpExist = (params) => wxRequest(params, apiMall + '/card/isExist');
//备注列表
const remarkList = (params) => wxRequest(params, apiMall + '/remarks/list');
//提醒列表
const remindList = (params) => wxRequest(params, apiMall + '/remind/list');
//发票列表
const invoiceList = (params) => wxRequest(params, apiMall + '/invoice/list');
//发票详情
const invoiceDetai = (params) => wxRequest(params, apiMall + '/invoice/detail');
//发票添加或编辑
const invoicAddorEdit = (params) => wxRequest(params, apiMall + '/invoice/addOrEdit');
//删除发票
const invoiceDelete = (params) => wxRequest(params, apiMall + '/invoice/delete');
//消息接口
const sysMessage = (params) => wxRequest(params, apiMall + '/notice/sysMessage');
//删除消息
const deleteMsg = (params) => wxRequest(params, apiMall + '/sendcode/deleteMsg');
//拖动排序(我的名片列表)
const sortById = (params) => wxRequest(params, apiMall + '/user/sortById');
// 个人认证信息
const userCertification = (params) => wxRequest(params, apiMall + '/certification/userCertification');



//===================wxUpload start========================
//添加名片图片和背景图
const addImg = (params) => wxUploadFile(params, apiMall + '/card/addImg');
// 上传认证
var certification = (params) => wxUploadFile(params, apiMall + '/certification/certification');
//===================wxUpload end========================



//==================图片验证码================
const verifyCode = apiMall + "/captcha";



export default {
  wxJsCode2Session,
  userInfo2Token,
  addMyCard,
  verifyCode,
  sendCode,
  changeCode,
  index,
  findCollect,
  detail,
  collAddOrEdit,
  cardDelete,
  findGroup,
  distribution,
  editSource,
  cardAddOrEdit,
  inpExist,
  addImg,
  remarkList,
  remindList,
  invoiceList,
  invoiceDetai,
  invoicAddorEdit,
  invoiceDelete,
  sysMessage,
  deleteMsg,
  sortById,
  userCertification,
  certification
}
